/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package be.ua.ac.comp.projectGPT.auctionPolicies;

import be.ac.ua.comp.projectGPT.auctions.Auction;
import be.ac.ua.comp.projectGPT.exceptions.InitializationException;
import java.util.Observable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Abstraction for an auction policy.
 */
public abstract class AuctionPolicy extends Observable {

    Auction auction;
    boolean initialized = false;
        final Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName());

        public AuctionPolicy() {
            logger.info("Creating");
        }

    public void setAuction(Auction auction) {
        logger.info("Setting auction");
        this.auction = auction;
        initialized = true;
    }

    /**
     * Initializes the policy.
     * 
     * @throws InitializationException Thrown when the policy is not initialized.
     */
    public abstract void start() throws InitializationException;

    /**
     * Checks wether the auction can stop.
     *
     * @return True/False depending on the current state of the auction.
     * @throws InitializationException Thrown when the policy is not initialized.
     */
    public abstract boolean stop() throws InitializationException;
}
